package com.xinan.dmgl.cggl;

import com.jfinal.ext.plugin.tablebind.TableBind;
import com.jfinal.kit.StringKit;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Model;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;

import java.sql.Timestamp;
import java.util.List;
import java.sql.Date;

@TableBind(tableName = "dm_cjgl")
public class DmCjgl extends Model<DmCjgl>{
    public static final DmCjgl dao = new DmCjgl();

    //columns START
    private String ID = "id";  //
    private String CJMC = "cjmc";  //厂家名称
    private String CJDM = "cjdm";  //拼音头
    private String LXR = "lxr";  //联系人
    private String LXDH = "lxdh";  //联系电话
    private String WX = "wx";  //微信号
    private String FHDZ = "fhdz";  //发货地址
    private String BZ = "bz";  //备注

    public void setId(int value) {
        set(ID, value);
    }

	public int getId() {
		return get(ID);
	}
    public void setCjmc(String value) {
        set(CJMC, value);
    }

	public String getCjmc() {
		return get(CJMC);
	}
    public void setCjdm(String value) {
        set(CJDM, value);
    }

	public String getCjdm() {
		return get(CJDM);
	}
    public void setLxr(String value) {
        set(LXR, value);
    }

	public String getLxr() {
		return get(LXR);
	}
    public void setLxdh(String value) {
        set(LXDH, value);
    }

	public String getLxdh() {
		return get(LXDH);
	}
    public void setWx(String value) {
        set(WX, value);
    }

	public String getWx() {
		return get(WX);
	}
    public void setFhdz(String value) {
        set(FHDZ, value);
    }

	public String getFhdz() {
		return get(FHDZ);
	}
    public void setBz(String value) {
        set(BZ, value);
    }

	public String getBz() {
		return get(BZ);
	}
	//columns END

    public List<DmCjgl> findAll() {
        return find("select * from dm_cjgl");
    }
    /**
     * @param   where
     * @return  Record
     */
    public List<Record> findAlls(String where) {
        String sqlExp = " from dm_cjgl";
        if(StringKit.notBlank(where)){
                sqlExp += " where " + where;
        }
                return Db.find( "select * " +sqlExp );

    }

    public Page<DmCjgl> page(int pageNumber, int pageSize, String where) {
        String sqlExp = "from dm_cjgl";
        if(StringKit.notBlank(where)){
            sqlExp += " where " + where;
        }
        return paginate(pageNumber, pageSize, "select *", sqlExp);
    }
}

